
package com.shop.cloud.controller.test;


import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.shop.cloud.filter.CurrentUserId;
import com.shop.cloud.filter.IgnoreAuth;
import com.shop.cloud.model.request.LoginRequest;
import com.shop.cloud.model.response.LoginResponse;
import com.shop.cloud.model.response.ObjectDataResponse;

import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

/**
 * 测试
 */
@RestController
@RequestMapping("test")
public class DemoController {
    
    @IgnoreAuth
    @ApiOperation(value = "测试接口", notes = "测试接口")
	@RequestMapping(value = "test", method = RequestMethod.POST)
	@ResponseBody
	public ObjectDataResponse<LoginResponse> test(@ApiParam(hidden=true,name="登录用户ID")@CurrentUserId Long userId,@RequestBody LoginRequest loginRequest)  {
		System.out.println("--------------------test------------------------userId-["+userId+"]");
		loginRequest.setUsername(loginRequest.getUsername()+"----login");
		LoginResponse loginResponse=new LoginResponse();
		loginResponse.setCode(20000);
		return new ObjectDataResponse<LoginResponse>(loginResponse);
	}
    
    @ApiOperation(value = "测试接口", notes = "测试接口")
   	@RequestMapping(value = "test02", method = RequestMethod.POST)
   	@ResponseBody
   	public ObjectDataResponse<Boolean> test02(@ApiParam(hidden=true,name="登录用户ID")@CurrentUserId Long userId,@RequestBody LoginRequest loginRequest)  {
   		System.out.println("--------------------test------------------------userId-["+userId+"]");
   		loginRequest.setUsername(loginRequest.getUsername()+"----login");
   		return new ObjectDataResponse<Boolean>(true);
   	}
    
    @ApiOperation(value = "测试接口", notes = "测试接口")
   	@RequestMapping(value = "test03", method = RequestMethod.GET)
   	@ResponseBody
   	public ObjectDataResponse<Boolean> test03(@ApiParam(hidden=true,name="登录用户ID")@CurrentUserId Long userId)  {
   		System.out.println("--------------------test------------------------userId-["+userId+"]");
   		return new ObjectDataResponse<Boolean>(true);
   	}

}
